
 

#setting up a graphics panel with 2 rows
#and 2 cols (ie 4 plots)

par(mfrow=c(2,2))
k = 100
len = 200
offset = 0

for(i in 1:2)
{


#setting up the parameter values for the logistic function
X = logist(r=i+offset,length=len, K=k, x0=70)

#making a time series plot
plot(X, xlab="time", ylab="abundance")

 

#adding a line to the plot
# (normally, only data points are shown)
lines(X)


#adding title
title(c("Time Series of Population Abundance, r=",i+offset))



#creating the state space plot with Xt as a function of
#Xt-1. First line is theoretical curve between 0 and K
curve(x*exp((i+offset)*(1-x/k)),0,max(X), xlab="Xt-1", ylab="Xt")

 

#adding the 1-to-1 line (slope of 1, starting from 0)
lines(c(0,250), c(0,250))

 

#adding the points from the simulation to the graph
points(X[1:len-1], X[2:len], col="red")

 
#adding the line to connect the point
lines(X[1:len-1], X[2:len], col="red")
}
